package com.api.syh56.shengyunhui.util;

import com.alibaba.nls.client.protocol.NlsClient;
import com.api.syh56.shengyunhui.entity.util.SpeechLongSynthesizerUtil;
import com.api.syh56.shengyunhui.properties.AliOssProperties;
import com.api.syh56.shengyunhui.properties.AliSpeechProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AliSpeechUtil {

    @Autowired
    private AliSpeechProperties aliSpeechProperties;

    @Autowired
    private NlsClient nlsClient;

    // 语音合成
    public  void textToSpeech(String text,String pathName) {
        // 创建SpeechLongSynthesizerUtil实例
        System.out.println("****************************************************************************************************");
        SpeechLongSynthesizerUtil demo = new SpeechLongSynthesizerUtil(aliSpeechProperties.getAppKey(), nlsClient);
        demo.process(text,pathName);
    }

}
